home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / chooser / tbmenu.tru < prev    next >
Text File  |  1994-08-02  |  2KB  |  72 lines

  1. external
  2. ! main menu loop for tb demos
  3. module tb
  4. DECLARE PUBLIC tbpts(,),tbtxt$()
  5. sub tb_demos
  6.  
  7.     call draw_tb
  8.     call waitup
  9.     do
  10.         call getclick_tb(op)
  11.     if op=1 then 
  12.         chain "!cd ../demos/tb;../../basic/tru -i barchart.tru &",return
  13.     elseif op=2 then
  14.         chain "!cd ../demos/tb;../../basic/tru -i bounce.tru &",return
  15.     elseif op=3 then
  16.         chain "!cd ../demos/tb;../../basic/tru -i hanoi.tru &",return
  17.     elseif op=4 then
  18.         chain "!cd ../demos/tb;../../basic/tru -i abouttb.tru &",return
  19.     elseif op=5 then
  20.         chain "!cd ../demos/tb;../../basic/tru -i hilbert.tru &",return
  21.     elseif op=6 then
  22.         chain "!cd ../demos/tb;../../basic/tru -i lissa.tru &",return
  23.     elseif op=7 then
  24.         chain "!cd ../demos/tb;../../basic/tru -i spiro.tru &",return
  25.     elseif op=0 then
  26.         exit sub
  27.     end if
  28.     if op<>0 and op<>-1 then
  29.                 call expand(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4))
  30.    draw textbox(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4),tbtxt$(op))
  31.                 call waitup
  32.         pause 3
  33.                call unexpand(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4))
  34.    draw textbox(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4),tbtxt$(op))
  35.     end if
  36.  
  37.     if refresh(1)=1 then 
  38.         call draw_tb
  39.     end if
  40.     loop
  41. end sub
  42.  
  43. sub draw_tb
  44.         let u=ubound(tbpts,1)
  45.         clear
  46.         for i=1 to u
  47.                 draw tbbox(i)
  48.         next i
  49.         box keep 0,1,0,1 in tbbox$
  50. end sub
  51.  
  52. picture tbbox(op)
  53.     draw box(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4),op)
  54.    draw textbox(tbpts(op,1),tbpts(op,2),tbpts(op,3),tbpts(op,4),tbtxt$(op))
  55. end picture
  56.  
  57. sub getclick_tb(op)
  58.         get mouse x,y,state
  59.         let op=-1
  60.         if state<>0 and x>=0 and x<=1 and y>=0 and y<=1 then
  61.            let u=ubound(tbpts,1)
  62.        let op=0
  63.            for i=1 to u
  64.                 if x>tbpts(i,1) and x<tbpts(i,2) and y>tbpts(i,3) and y<tbpts(i,4) then
  65.                         let op=i
  66.                         exit sub
  67.                 end if
  68.            next i
  69.         end if
  70. end sub
  71. end module
  72.